package subraSoft.centaurus.gui.components;

import java.awt.Component;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Formateador de fecha para tabla.
 * 
 * @author caeycae
 *
 */
public class CenDateCellRenderer extends DefaultTableCellRenderer
{
	private static final long serialVersionUID = 1L;

	public Component getTableCellRendererComponent(JTable table, Object value, boolean
			isSelected, boolean hasFocus, int row, int column)
	{
		super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column );
		
		if ( value instanceof Date )
		{
			String strDate = new SimpleDateFormat("MM/dd/yyyy").format((Date)value);
			this.setText( strDate );
		}

		return this;
	}
}